home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1988 June
/
1988-06.d64
/
64 mlx
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
4KB
|
105 lines
10 rem version 1.1: lines 830,950 modified, lines 485-487 added
100 poke 56,50:clr:dim in$,i,j,a,b,a$,b$,a(7),n$
110 c4=48:c6=16:c7=7:z2=2:z4=254:z5=255:z6=256:z7=127
120 fa=peek(45)+z6*peek(46):bs=peek(55)+z6*peek(56):h$="0123456789abcdef"
130 r$=chr$(13):l$="[157]":s$=" ":d$=chr$(20):z$=chr$(0):t$=""
140 sd=54272:for i=sd to sd+23:poke i,0:next:poke sd+24,15:poke 788,52
150 print"[147]"chr$(142)chr$(8):poke 53280,15:poke 53281,15
160 print t$" [164][164][164][164][164][164][164][164] "spc(28)" [146] mlx ii "spc(28)" "
170 print" compute!'s machine language editor"
180 print"[144]starting address[151]";:gosub300:sa=ad:gosub1040:if f then180
190 print"[144] ending address[151]";:gosub300:ea=ad:gosub1030:if f then190
200 input"[144]clear workspace [y/n][151]";a$:if left$(a$,1)<>"y"then220
210 print"working...";:fori=bs to bs+ea-sa+7:poke i,0:next:print"done"
220 printtab(10)"[144] mlx command menu [151]":print t$"e[146]nter data"
230 print t$"d[146]isplay data":print t$"l[146]oad file"
240 print t$"s[146]ave file":print t$"q[146]uit[144]"
250 get a$:if a$=n$ then250
260 a=0:for i=1 to 5:if a$=mid$("edlsq",i,1)then a=i:i=5
270 next:on a goto420,610,690,700,280:gosub1060:goto250
280 print" quit ":input"[151]are you sure [y/n]";a$:if left$(a$,1)<>"y"then220
290 poke sd+24,0:end
300 in$=n$:ad=0:inputin$:iflen(in$)<>4thenreturn
310 b$=in$:gosub320:ad=a:b$=mid$(in$,3):gosub320:ad=ad*256+a:return
320 a=0:for j=1 to 2:a$=mid$(b$,j,1):b=asc(a$)-c4+(a$>"@")*c7:a=a*c6+b
330 if b<0 or b>15 then ad=0:a=-1:j=2
340 next:return
350 b=int(a/c6):print mid$(h$,b+1,1);:b=a-b*c6:print mid$(h$,b+1,1);:return
360 a=int(ad/z6):gosub350:a=ad-a*z6:gosub350:print":";
370 ck=int(ad/z6):ck=ad-z4*ck+z5*(ck>z7):goto390
380 ck=ck*z2+z5*(ck>z7)+a
390 ck=ck+z5*(ck>z5):return
400 print"starting at[151]";:gosub300:if in$<>n$ then gosub1030:if f then400
410 return
420 print" enter data ":gosub400:if in$=n$ then220
430 open3,3:print
440 poke198,0:gosub360:if f then print in$:print"[145]";
450 for i=0 to 24 step 3:b$=s$:for j=1 to 2:if f then b$=mid$(in$,i+j,1)
460 print""b$l$;:if i<24then print"[146]";
470 get a$:if a$=n$ then470
480 if(a$>"/"anda$<":")or(a$>"@"anda$<"g")then540
485 a=-(a$="m")-2*(a$=",")-3*(a$=".")-4*(a$="/")-5*(a$="j")-6*(a$="k")
486 a=a-7*(a$="l")-8*(a$=":")-9*(a$="u")-10*(a$="i")-11*(a$="o")-12*(a$="p")
487 a=a-13*(a$=s$):if a then a$=mid$("abcd123e456f0",a,1):goto 540
490 if a$=r$ and((i=0)and(j=1)or f)then print b$;:j=2:next:i=24:goto550
500 if a$="" then print b$:j=2:next:i=24:next:f=0:goto440
510 if(a$="")andf thenprint b$l$;:goto540
520 if a$<>l$ and a$<>d$ or((i=0)and(j=1))then gosub1060:goto470
530 a$=l$+s$+l$:print b$l$;:j=2-j:if j then print l$;:i=i-3
540 print a$;:next j:print s$;
550 next i:print:print"[145]";:input#3,in$:if in$=n$ then close3:goto220
560 for i=1 to 25 step3:b$=mid$(in$,i):gosub320:if i<25 then gosub380:a(i/3)=a
570 next:if a<>ck then gosub1060:print"[144] error: reenter line [151]":f=1:goto440
580 gosub1080:b=bs+ad-sa:for i=0 to 7:poke b+i,a(i):next
590 ad=ad+8:if ad>ea then close3:print"** end of entry **[144]":goto700
600 f=0:goto440
610 print"[147] display data ":gosub400:if in$=n$ then220
620 print"press: space[146] to pause, return[146] to break[151]"
630 gosub360:b=bs+ad-sa:fori=bto b+7:a=peek(i):gosub350:gosub380:print s$;
640 next:print"";:a=ck:gosub350:print
650 f=1:ad=ad+8:if ad>ea thenprint"** end of data **":goto220
660 get a$:if a$=r$ then gosub1080:goto220
670 if a$=s$ then f=f+1:gosub1080
680 onfgoto630,660,630
690 print" load data ":op=1:goto710
700 print" save file ":op=0
710 in$=n$:input"filename[151]";in$:if in$=n$ then220
720 f=0:print"[144]t[146]ape or d[146]isk: [151]";
730 get a$:if a$="t"then print"t":goto880
740 if a$<>"d"then730
750 print"d":open15,8,15,"i0:":b=ea-sa:in$="0:"+in$:if op then810
760 open 1,8,8,in$+",p,w":gosub860:if a then220
770 ah=int(sa/256):al=sa-(ah*256):print#1,chr$(al);chr$(ah);
780 for i=0 to b:print#1,chr$(peek(bs+i));:if st then800
790 next:close1:close15:goto940
800 gosub1060:print"[144]error during save:[151]":gosub860:goto220
810 open 1,8,8,in$+",p,r":gosub860:if a then220
820 get#1,a$,b$:ad=asc(a$+z$)+256*asc(b$+z$):if ad<>sa then f=1:goto850
830 for i=0 to b:get#1,a$:poke bs+i,asc(a$+z$):if(i<>b)and st then f=2:ad=i:i=b
840 next:if st<>64 then f=3
850 close1:close15:on abs(f>0)+1 goto960,970
860 input#15,a,a$:if a then close1:close15:gosub1060:print"error: "a$
870 return
880 poke183,peek(fa+2):poke187,peek(fa+3):poke188,peek(fa+4):ifop=0then920
890 sys 63466:if(peek(783)and1)then gosub1060:print" file not found ":goto690
900 ad=peek(829)+256*peek(830):if ad<>sa then f=1:goto970
910 a=peek(831)+256*peek(832)-1:f=f-2*(a<ea)-3*(a>ea):ad=a-ad:goto930
920 a=sa:b=ea+1:gosub1010:poke780,3:sys 63338
930 a=bs:b=bs+(ea-sa)+1:gosub1010:on op goto950:sys 63591
940 gosub1080:print"** save completed **":goto220
950 poke147,0:sys 63562:if st>0 then970
960 gosub1080:print"** load completed **":goto220
970 gosub1060:print"[144]error during load:[151]":on f gosub980,990,1000:goto220
980 print"incorrect starting address (";:gosub360:print")":return
990 print"load ended at ";:ad=sa+ad:gosub360:print d$:return
1000 print"truncated at ending address":return
1010 ah=int(a/256):al=a-(ah*256):poke193,al:poke194,ah
1020 ah=int(b/256):al=b-(ah*256):poke174,al:poke175,ah:return
1030 if ad<sa or ad>ea then1050
1040 if(ad>511 and ad<40960)or(ad>49151 and ad<53248)then gosub1080:f=0:return
1050 gosub1060:print" invalid address [144]":f=1:return
1060 poke sd+5,31:poke sd+6,208:poke sd,240:poke sd+1,4:poke sd+4,33
1070 for s=1 to 100:next:goto1090
1080 poke sd+5,8:poke sd+6,240:poke sd,0:poke sd+1,90:poke sd+4,17
1090 for s=1 to 100:next:poke sd+4,0:poke sd,0:poke sd+1,0:return